package pri.zxx.learndemo.gsondemo;

import lombok.extern.slf4j.Slf4j;
import pri.zxx.learndemo.lambdaandstream.entity.Employee;
import pri.zxx.learndemo.lambdaandstream.functions.Out;
import pri.zxx.webdemo.utils.GsonUtil;

import java.util.Map;

@Slf4j
public class GsonTest {
    public static void main(String[] args) {
        String s = GsonUtil.gson.toJson(new Employee("1", 1, 2213));
        log.warn("s：{}", s);
        Map<String, Object> map = GsonUtil.gson.fromJson("{\"name\":\"1\",\"age\":1,\"salary\":2213.0}", Map.class);
        map.forEach((s1, o) -> Out.println(s1 + ":" + o));
    }
}
